package com.itany.book.service.impl;

import com.itany.mapper.ManagerMapper;
import com.itany.pojo.Manager;
import com.itany.service.ManagerService;
import com.itany.vo.ActionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Description: 类的描述
 * Author: SJY
 * Date: 2021/09/01 15:58
 * Version: 1.0 版本信息
 */
@Service
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRED)
public class ManagerServiceImpl implements ManagerService {
    @Autowired
    ManagerMapper managerMapper;

    public ActionResult selectLogin(Manager manager) {
        ActionResult ar = new ActionResult();
        try{
            Manager m = managerMapper.selectLogin(manager);
            ar.setMsg("查询成功");
            ar.setStatus(1);
            ar.setData(m);
        }catch(Exception e){
            e.printStackTrace();
            ar.setMsg("登录失败，请检查帐号密码是否正确");
            ar.setStatus(0);
        }finally {
            return ar;
        }
    }
}
